package com.hrg.demo.service;

import com.dahuatech.icc.util.BeanUtil;
import com.hrg.demo.entity.RemoteCaptureResponse;
import com.hrg.demo.entity.RemoteCaptureResult;
import com.hrg.demo.oss.PicDownloadDemo;
import com.hrg.demo.remoteCapture.RemoteCaptureDemo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * @Author: zy
 * @Version: 1.0
 */
@Slf4j
@Component
public class StartService implements CommandLineRunner {
//    private RemoteCaptureDemo remoteCaptureDemo;
//    private PicDownloadDemo picDownloadDemo;
//    public StartService() {
//        remoteCaptureDemo = new RemoteCaptureDemo();
//        this.picDownloadDemo = new PicDownloadDemo();
//    }

    @Override
    public void run(String... args) throws Exception {

//        RemoteCaptureResponse remoteCaptureResponse = remoteCaptureDemo.remoteCapture(111L,"1000060$1$0$259");
//        if(remoteCaptureResponse.getCode().equals("1000")) {
//            RemoteCaptureResult captureResult = BeanUtil.toBean(remoteCaptureResponse.getData(), RemoteCaptureResult.class);
//            String imagePath = captureResult.getParams().getPicInfo();
//            System.out.println("远程设备抓图获取的图片地址： "+imagePath);
//            log.info("远程设备抓图获取的图片地址：{}", imagePath);
//            String imageFullPath=picDownloadDemo.getHttpsImageFullPath(imagePath);
//            picDownloadDemo.download(imageFullPath,"D://images");
//        }
    }
}
